package sketch;

import sketch.main.SketchTestOptions;
import sketch.util.IntermediateFiles;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class AllTests extends TestCase {
	public static Test suite() {
		TestSuite suite = new TestSuite();
		
		suite.addTest(sketch.ast.ASTUtilTest.suite());
		suite.addTest(sketch.ast.ASTCopyTest.suite());
		suite.addTest(sketch.ast.ScannerTest.suite());
		suite.addTest(sketch.ast.ASTFindVariableDeclarationTest.suite());
		suite.addTest(sketch.ast.ASTFormatTest.suite());
		
		suite.addTest(sketch.generator.AssertionSequenceGeneratorTest.suite());
		suite.addTest(sketch.generator.ExhaustiveSequenceGeneratorTest.suite());
		suite.addTest(sketch.generator.ExhaustiveValueGenerationTest.suite());
		suite.addTest(sketch.generator.PermutationValueGeneratorTest.suite());
		suite.addTest(sketch.generator.RandomSequenceGeneratorTest.suite());
		suite.addTest(sketch.generator.SingleSequenceGeneratorTest.suite());
		suite.addTest(sketch.generator.UnitTestGeneratorTest.suite());
		suite.addTest(sketch.generator.ExhaustiveTypedValueGeneratorTest.suite());
		suite.addTest(sketch.generator.SubsetValueGeneratorTest.suite());
		
		suite.addTest(sketch.generator.experiment.BasicValuesTest.suite());
		suite.addTest(sketch.generator.experiment.VariousValueGroupGeneratorTest.suite());
		
		suite.addTest(sketch.instrumenter.SourceInstrumenterTest.suite());
		suite.addTest(sketch.instrumenter.TracerFileReaderTest.suite());
		
		suite.addTest(sketch.main.MainTest.suite());
		suite.addTest(sketch.main.TestSketchValidatorTest.suite());
		suite.addTest(sketch.main.SketchTestMainTest.suite());
		
		suite.addTest(sketch.examples.TreeMapSketchExample.suite());
		
		suite.addTest(sketch.specs.RandomObjectGenerationTest.suite());
		suite.addTest(sketch.specs.BlockMappingVisitorTest.suite());
		suite.addTest(sketch.specs.SourceExpansionTest.suite());
		suite.addTest(sketch.specs.VariableDeclarationVisitorTest.suite());
		suite.addTest(sketch.specs.DeclaredValuesFinderTest.suite());
		suite.addTest(sketch.specs.UnusedVarDeclarationTest.suite());
		suite.addTest(sketch.specs.MethodDeclarationDumperTest.suite());
		suite.addTest(sketch.specs.DeclaredValueExtractorTest.suite());
		suite.addTest(sketch.specs.SketchedMethodCreatorTest.suite());
		suite.addTest(sketch.specs.SketchedMethodDeclarationTest.suite());
		suite.addTest(sketch.specs.UsedVariableVisitorTest.suite());
		suite.addTest(sketch.specs.WriteGenTestToFileTest.suite());
		suite.addTest(sketch.specs.SketchedBlockExpansionTest.suite());
		suite.addTest(sketch.specs.ParenthesesRemoverTest.suite());
		suite.addTest(sketch.specs.SymbolicValueVisitorTest.suite());
		suite.addTest(sketch.specs.SymbolicCommandTest.suite());
		suite.addTest(sketch.specs.SketchedExhaustBlockTest.suite());
		suite.addTest(sketch.specs.SketchedTryCatchBlockTest.suite());
		suite.addTest(sketch.specs.SketchedIdentifierBlockTest.suite());
		suite.addTest(sketch.specs.RandomSymbolicTreeMapGenTest.suite());
		suite.addTest(sketch.specs.TreeMapSketchingTest.suite());
		suite.addTest(sketch.specs.SymbolicFileParsingTest.suite());
		suite.addTest(sketch.specs.MethodrepInstanitiationsTest.suite());
		suite.addTest(sketch.specs.SketchTestProcessorTest.suite());
		suite.addTest(sketch.specs.ValueExpansionByDeclarationTest.suite());
		
		suite.addTest(sketch.specs.symbc.SymbolicJPFTest.suite());
		suite.addTest(sketch.specs.symbc.SymbolicExecDriverCreationTest.suite());
		suite.addTest(sketch.specs.symbc.SymbolicJPFOtherTypesTest.suite());
		
		suite.addTest(sketch.ounit.ObserverTest.suite());
		suite.addTest(sketch.ounit.ValuesTest.suite());
		suite.addTest(sketch.ounit.ObservationInstantiationVisitorTest.suite());
		
		suite.addTest(sketch.ounit.fuzz.ObjectFuzzerTest.suite());
		suite.addTest(sketch.ounit.fuzz.ExistingObjectFuzzerTest.suite());
		suite.addTest(sketch.ounit.fuzz.NewObjectFuzzerTest.suite());
		suite.addTest(sketch.ounit.fuzz.SketchGuidedRandomGeneratorTest.suite());
		suite.addTest(sketch.ounit.fuzz.ExistingObjectFuzzerExceptionThrowingTest.suite());
		suite.addTest(sketch.ounit.fuzz.SketchGuidedRandomGeneratorExceptionTest.suite());
		suite.addTest(sketch.ounit.fuzz.RandomFuzzExtractorTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceWithArgsTest.suite());
		suite.addTest(sketch.ounit.fuzz.SketchGuidedRandomGeneratorWithArgsTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectCreationTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectCreationWithArgsTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectCreationCombinationTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectMutationTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectMutationWithArgsTest.suite());
		suite.addTest(sketch.ounit.fuzz.AssembledSequenceObjectMutationCombinationTest.suite());
		suite.addTest(sketch.ounit.fuzz.ImprovedSketchGuidedTestGenTest.suite());
		suite.addTest(sketch.ounit.fuzz.RandomValueWithSetUpTearDownTest.suite());
		
		suite.addTest(sketch.generator.examples.DynamicGeneratorTest.suite());
		suite.addTest(sketch.generator.examples.ExhaustiveSequentialValueGeneratorTest.suite());
		suite.addTest(sketch.generator.examples.PairGeneratorTest.suite());
		suite.addTest(sketch.generator.examples.SequentialValueGeneratorTest.suite());
		
		suite.addTest(sketch.util.ReflectiveExecutionsTest.suite());
		
		suite.addTest(sketch.specs.annotation.ClassUseRepTest.suite());
		
		//suite.addTest(sketch.issta11.RunAllISSTA11Examples.suite());
		
		return suite;
	}
	
	public static void main(String[] args) {
		SketchTestOptions.verbose = false;
		junit.textui.TestRunner.run(AllTests.suite());
		//clean all intermediate files
		IntermediateFiles.addAllFilesAsIntermediates("./testfiles", ".class");
//		IntermediateFiles.addAllFilesAsIntermediatesNoRecursive("./", ".class");
//		IntermediateFiles.addAllFilesAsIntermediatesNoRecursive("./", ".java");
//		IntermediateFiles.addAllFilesAsIntermediatesNoRecursive("./", ".txt");
		IntermediateFiles.deleteIntermediateFiles();
	}
}